home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / QD3DStorage.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  7.8 KB  |  292 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        QD3DStorage.h
  3.  
  4.      Contains:    Abstraction to deal with various types of stream-based storage devices        
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DSTORAGE__
  18. #define __QD3DSTORAGE__
  19.  
  20. #ifndef __QD3D__
  21.     #include <QD3D.h>
  22. #endif
  23.  
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __MACTYPES__
  27.     #include <MacTypes.h>
  28. #endif
  29.  
  30. #ifndef __FILES__
  31.     #include <Files.h>
  32. #endif
  33.  
  34. #endif  /* TARGET_OS_MAC */
  35.  
  36.  
  37. #if TARGET_OS_WIN32
  38.     #include <windows.h>
  39. #endif /* TARGET_OS_WIN32 */
  40.  
  41. #include <stdio.h>
  42.  
  43.  
  44. #if PRAGMA_ONCE
  45. #pragma once
  46. #endif
  47.  
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. #if PRAGMA_IMPORT
  53. #pragma import on
  54. #endif
  55.  
  56. #if PRAGMA_STRUCT_ALIGN
  57.     #pragma options align=power
  58. #elif PRAGMA_STRUCT_PACKPUSH
  59.     #pragma pack(push, 2)
  60. #elif PRAGMA_STRUCT_PACK
  61.     #pragma pack(2)
  62. #endif
  63.  
  64. #if PRAGMA_ENUM_ALWAYSINT
  65.     #pragma enumsalwaysint on
  66. #elif PRAGMA_ENUM_OPTIONS
  67.     #pragma option enum=int
  68. #elif PRAGMA_ENUM_PACK
  69.     #if __option(pack_enums)
  70.         #define PRAGMA_ENUM_PACK__QD3DSTORAGE__
  71.     #endif
  72.     #pragma options(!pack_enums)
  73. #endif
  74.  
  75. /******************************************************************************
  76.  **                                                                             **
  77.  **                                Storage Routines                             **
  78.  **                                                                             **
  79.  *****************************************************************************/
  80. EXTERN_API_C( TQ3ObjectType )
  81. Q3Storage_GetType                (TQ3StorageObject         storage);
  82.  
  83. EXTERN_API_C( TQ3Status )
  84. Q3Storage_GetSize                (TQ3StorageObject         storage,
  85.                                  unsigned long *        size);
  86.  
  87. /* 
  88.  *    Reads "dataSize" bytes starting at offset in storage, copying into data. 
  89.  *    sizeRead returns the number of bytes filled in. 
  90.  *    
  91.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  92.  */
  93. EXTERN_API_C( TQ3Status )
  94. Q3Storage_GetData                (TQ3StorageObject         storage,
  95.                                  unsigned long             offset,
  96.                                  unsigned long             dataSize,
  97.                                  unsigned char *        data,
  98.                                  unsigned long *        sizeRead);
  99.  
  100. /* 
  101.  *    Write "dataSize" bytes starting at offset in storage, copying from data. 
  102.  *    sizeWritten returns the number of bytes filled in. 
  103.  *    
  104.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeWritten
  105.  */
  106. EXTERN_API_C( TQ3Status )
  107. Q3Storage_SetData                (TQ3StorageObject         storage,
  108.                                  unsigned long             offset,
  109.                                  unsigned long             dataSize,
  110.                                  const unsigned char *    data,
  111.                                  unsigned long *        sizeWritten);
  112.  
  113. /******************************************************************************
  114.  **                                                                             **
  115.  **                             Memory Storage Prototypes                         **
  116.  **                                                                             **
  117.  *****************************************************************************/
  118. EXTERN_API_C( TQ3ObjectType )
  119. Q3MemoryStorage_GetType            (TQ3StorageObject         storage);
  120.  
  121. /*
  122.  * These calls COPY the buffer into QD3D space
  123.  */
  124. EXTERN_API_C( TQ3StorageObject )
  125. Q3MemoryStorage_New                (const unsigned char *    buffer,
  126.                                  unsigned long             validSize);
  127.  
  128. EXTERN_API_C( TQ3Status )
  129. Q3MemoryStorage_Set                (TQ3StorageObject         storage,
  130.                                  const unsigned char *    buffer,
  131.                                  unsigned long             validSize);
  132.  
  133. /*
  134.  * These calls use the pointer given - you must dispose it when you're through
  135.  */
  136. EXTERN_API_C( TQ3StorageObject )
  137. Q3MemoryStorage_NewBuffer        (unsigned char *        buffer,
  138.                                  unsigned long             validSize,
  139.                                  unsigned long             bufferSize);
  140.  
  141. EXTERN_API_C( TQ3Status )
  142. Q3MemoryStorage_SetBuffer        (TQ3StorageObject         storage,
  143.                                  unsigned char *        buffer,
  144.                                  unsigned long             validSize,
  145.                                  unsigned long             bufferSize);
  146.  
  147. EXTERN_API_C( TQ3Status )
  148. Q3MemoryStorage_GetBuffer        (TQ3StorageObject         storage,
  149.                                  unsigned char **        buffer,
  150.                                  unsigned long *        validSize,
  151.                                  unsigned long *        bufferSize);
  152.  
  153. #if TARGET_OS_MAC
  154. /******************************************************************************
  155.  **                                                                             **
  156.  **                                Macintosh Handles Prototypes                 **
  157.  **                                                                             **
  158.  *****************************************************************************/
  159. /* Handle Storage is a subclass of Memory Storage */
  160. EXTERN_API_C( TQ3StorageObject )
  161. Q3HandleStorage_New                (Handle                 handle,
  162.                                  unsigned long             validSize);
  163.  
  164. EXTERN_API_C( TQ3Status )
  165. Q3HandleStorage_Set                (TQ3StorageObject         storage,
  166.                                  Handle                 handle,
  167.                                  unsigned long             validSize);
  168.  
  169. EXTERN_API_C( TQ3Status )
  170. Q3HandleStorage_Get                (TQ3StorageObject         storage,
  171.                                  Handle *                handle,
  172.                                  unsigned long *        validSize);
  173.  
  174. /******************************************************************************
  175.  **                                                                             **
  176.  **                                Macintosh Storage Prototypes                 **
  177.  **                                                                             **
  178.  *****************************************************************************/
  179. EXTERN_API_C( TQ3StorageObject )
  180. Q3MacintoshStorage_New            (short                     fsRefNum);
  181.  
  182. /* Note: This storage is assumed open */
  183. EXTERN_API_C( TQ3Status )
  184. Q3MacintoshStorage_Set            (TQ3StorageObject         storage,
  185.                                  short                     fsRefNum);
  186.  
  187. EXTERN_API_C( TQ3Status )
  188. Q3MacintoshStorage_Get            (TQ3StorageObject         storage,
  189.                                  short *                fsRefNum);
  190.  
  191. EXTERN_API_C( TQ3ObjectType )
  192. Q3MacintoshStorage_GetType        (TQ3StorageObject         storage);
  193.  
  194.  
  195. /******************************************************************************
  196.  **                                                                             **
  197.  **                            Macintosh FSSpec Storage Prototypes                 **
  198.  **                                                                             **
  199.  *****************************************************************************/
  200. EXTERN_API_C( TQ3StorageObject )
  201. Q3FSSpecStorage_New                (const FSSpec *            fs);
  202.  
  203. EXTERN_API_C( TQ3Status )
  204. Q3FSSpecStorage_Set                (TQ3StorageObject         storage,
  205.                                  const FSSpec *            fs);
  206.  
  207. EXTERN_API_C( TQ3Status )
  208. Q3FSSpecStorage_Get                (TQ3StorageObject         storage,
  209.                                  FSSpec *                fs);
  210.  
  211. #endif  /* TARGET_OS_MAC */
  212.  
  213. #if TARGET_OS_WIN32
  214. /******************************************************************************
  215.  **                                                                             **
  216.  **                            Win32 HANDLE Storage Prototypes                     **
  217.  **                                                                             **
  218.  *****************************************************************************/
  219. EXTERN_API_C( TQ3StorageObject )
  220. Q3Win32Storage_New                (HANDLE                 hFile);
  221.  
  222. EXTERN_API_C( TQ3Status )
  223. Q3Win32Storage_Set                (TQ3StorageObject         storage,
  224.                                  HANDLE                 hFile);
  225.  
  226. EXTERN_API_C( TQ3Status )
  227. Q3Win32Storage_Get                (TQ3StorageObject         storage,
  228.                                  HANDLE *                hFile);
  229.  
  230. #endif  /* TARGET_OS_WIN32 */
  231.  
  232.  
  233. /******************************************************************************
  234.  **                                                                             **
  235.  **                                    Unix Prototypes                             **
  236.  **                The Unix Storage prototypes have been obsoleted.             **
  237.  **                                                                             **
  238.  *****************************************************************************/
  239.  
  240.  
  241. /******************************************************************************
  242.  **                                                                             **
  243.  **                                Unix Path Prototypes                         **
  244.  **                                                                             **
  245.  *****************************************************************************/
  246. EXTERN_API_C( TQ3StorageObject )
  247. Q3UnixPathStorage_New            (const char *            pathName);
  248.  
  249. /* C string */
  250. EXTERN_API_C( TQ3Status )
  251. Q3UnixPathStorage_Set            (TQ3StorageObject         storage,
  252.                                  const char *            pathName);
  253.  
  254. /* C string */
  255. EXTERN_API_C( TQ3Status )
  256. Q3UnixPathStorage_Get            (TQ3StorageObject         storage,
  257.                                  char *                    pathName);
  258.  
  259. /* pathName is a buffer */
  260.  
  261.  
  262.  
  263.  
  264. #if PRAGMA_ENUM_ALWAYSINT
  265.     #pragma enumsalwaysint reset
  266. #elif PRAGMA_ENUM_OPTIONS
  267.     #pragma option enum=reset
  268. #elif defined(PRAGMA_ENUM_PACK__QD3DSTORAGE__)
  269.     #pragma options(pack_enums)
  270. #endif
  271.  
  272. #if PRAGMA_STRUCT_ALIGN
  273.     #pragma options align=reset
  274. #elif PRAGMA_STRUCT_PACKPUSH
  275.     #pragma pack(pop)
  276. #elif PRAGMA_STRUCT_PACK
  277.     #pragma pack()
  278. #endif
  279.  
  280. #ifdef PRAGMA_IMPORT_OFF
  281. #pragma import off
  282. #elif PRAGMA_IMPORT
  283. #pragma import reset
  284. #endif
  285.  
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289.  
  290. #endif /* __QD3DSTORAGE__ */
  291.  
  292.